﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.Utility;
using YouHP.BLL;
using System.Web;
using YouHP.Model;

namespace YouHP.Pages.User
{
    public class CommentList : YouHP.Pages.User.UserBasePage
    {
        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleGet();
        }

        protected List<CommentInfo> CommentDataList;
        protected int PageIndex;
        protected int DataCount;
        protected int PageCount;
        protected string PagingString;

        protected void HandleGet()
        {
            this.SetTitle("我的留言");

            PageIndex = RequestTools.GetQueryInt("page", 1);

            CommentDataList = CommentBLL.Instance.GetCommentList(10, PageIndex, UserData.Id, out DataCount);

            PageCount = Utils.GetPageCount(DataCount, 10);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");

            PagingString = this.GetPagingString(
                PageIndex,
                PageCount,
                "/User/CommentList.aspx" + query, "page");
        }
    }
}
